<?php
if ($sf_user->isAuthenticated()) {
    $g_user = $sf_user->getGuardUser();
    ?>
    <div class="welcome_bar">
        <div class="welcome">
            <?php echo __('Welcome') . ' '; ?>
            <span class="user_name"><?php echo $g_user->getName() ?></span> | <a href="<?php echo url_for('sfGuardAuth/change_password') ?>"><?php echo __('change password') ?></a>
            <?php $teacher = $sf_user->getTeacherObject(); ?>
            <?php if ($teacher) { ?>
                | <?php echo $teacher->getSchool(); ?>
    <?php } ?>
        </div>
        <div class="account_links">
            <?php if ($teacher && $teacher->getIsManager() && !$sf_user->hasAttribute('teacher_mode')) { ?>
                <?php
                echo
                link_to(__('Add a Teacher'), 'teacher/add') . ' | ' .
                link_to(__('Program Assignment List'), 'assignment/index') . ' | ' .
                link_to(__('School Teachers'), 'teacher/managerTeachers') . ' | ' .
                link_to(__('Private messages'), 'private_messages/show') . ' ( ' . PrivateMessagesTable::getCountNotRead($g_user->getId()) . ' ) | ' .
                link_to(__('Logout'), '@sf_guard_signout')
                ?>

            <?php } elseif ($teacher && $teacher->getIsTrainer() && !$sf_user->hasAttribute('teacher_mode')) { ?>        
                <?php echo link_to(__('Programs'), 'program/trainerPrograms') . ' | ' .
                link_to(__('Logout'), '@sf_guard_signout'); ?>
            <?php } else if ($sf_user->hasAttribute('teacher_mode')) { ?>
                <?php echo link_to(__('Home page'), 'home/teacher'). ' | '  ?>
                <?php echo link_to(__('Logout'), '@sf_guard_signout'); ?>
            <?php } else { ?>
                <?php echo link_to(__('Logout'), '@sf_guard_signout'); ?>
    <?php } ?>
        </div>
        <div class="clear"></div>
    </div>
<?php } ?>